package com.gxa.service.Impl;

import com.gxa.common.R;
import com.gxa.mapper.StatisticsMapper;
import com.gxa.service.StatisticsService;
import com.gxa.pojo.statistics.*;
import com.gxa.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatisticsServiceImpl implements StatisticsService {
    @Autowired(required = false)
    private StatisticsMapper statisticsMapper;


    //综合数据接口
    @Override
    public R comprehensiveData() {
        R r = new R();
        //拿到数据
        ComprehensiveData pojo = statisticsMapper.comprehensiveData();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //人才储备接口
    @Override
    public R talentReserve() {
        R r = new R();
        //拿到数据
        TalentReserve pojo = statisticsMapper.talentReserve();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //部门员工接口
    @Override
    public R departmentStaff() {
        R r = new R();
        //拿到数据
        List<DepartmentStaff> list = statisticsMapper.departmentStaff();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(list);

        System.out.println(r+"\n");
        return r;
    }

    //员工基本接口
    @Override
    public R employeeBasic() {
        R r = new R();
        //拿到数据
        EmployeeBasic pojo = statisticsMapper.employeeBasic();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //员工月份接口
    @Override
    public R employeeMonth() {
        R r = new R();
        //获取当前年份
        String date = DateUtils.getCurrentTime();
        System.out.println(date + date.substring(0,5));
        System.out.println((date.substring(0,5)).concat("01"));
        //拿到数据
        EmployeeMonth pojo = statisticsMapper.employeeMonth((date.substring(0,5)).concat("01"),(date.substring(0,5)).concat("02"),(date.substring(0,5)).concat("03"),(date.substring(0,5)).concat("04"),(date.substring(0,5)).concat("05"),(date.substring(0,5)).concat("06"),(date.substring(0,5)).concat("07"),(date.substring(0,5)).concat("08"),(date.substring(0,5)).concat("09"),(date.substring(0,5)).concat("10"),(date.substring(0,5)).concat("11"),(date.substring(0,5)).concat("12"));
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //员工性别接口
    @Override
    public R employeeSex() {
        R r = new R();
        //拿到数据
        EmployeeSex pojo = statisticsMapper.employeeSex();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //在职状态接口
    @Override
    public R jobStatus() {
        R r = new R();
        //拿到数据
        EmployeeBasic pojo = statisticsMapper.jobStatus();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }

    //黑名单接口
    @Override
    public R blackList() {
        R r = new R();
        //拿到数据
        EmployeeBasic pojo = statisticsMapper.blackList();
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(pojo);

        System.out.println(r+"\n");
        return r;
    }
}
